//
//  KTConsumerGoodCategoryCollectCell.m
//  OMENGO_NEW
//
//  Created by 梁尚嘉 on 2017/5/4.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "KTConsumerGoodCategoryCollectCell.h"

@implementation KTConsumerGoodCategoryCollectCell




- (void)setBadge:(NSUInteger)number
{
    //    _badgeView.hidden = !number;
    //    [_badgeView setTitle:[@(number)stringValue] forState:UIControlStateNormal];
}


- (void)configure
{
    [super configure];
    self.contentView.backgroundColor = [UIColor clearColor];
    self.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.selectBackground];
    [self.selectBackground mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@0);
    }];

    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(SM_SIZE(20)));
        make.right.equalTo(@(SM_SIZE(-20)));
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.height.equalTo(@(SM_SIZE(50)));
    }];

}

- (void)setKt_selected:(BOOL)kt_selected
{
    _kt_selected = kt_selected;

    self.titleLabel.textColor = kt_selected? SM_whiteColor : SM_darkGrayColor;
    self.titleLabel.backgroundColor = _kt_selected ? SM_thumeColor : [UIColor clearColor];
    if (kt_selected) {
        [self.titleLabel addInstanceScaleAnimationWithTargetScale:1.1 reverse:true duration:.1];
    }
}

- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [UILabel new];
        _titleLabel.font = SM_CFont(28);
        _titleLabel.layer.cornerRadius = SM_SIZE(25);
        _titleLabel.clipsToBounds = true;
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLabel;
}

- (UIView *)line
{
    if (!_line) {
        _line = [UIView new];
        _line.backgroundColor = SM_whiteColor;
    }
    return _line;
}

- (UIView *)selectBackground
{
    if (!_selectBackground) {
        _selectBackground = [UIView new];
        _selectBackground.backgroundColor = SM_whiteColor;
        _selectBackground.hidden = YES;

    }
    return _selectBackground;
}

@end
